Flash memory devices store information with high density on flash memory cells with ever smaller dimensions. In addition, Multi-Level Cells (MLC) may store several bits per cell (bpc).
Flash memory devices are organized into physical pages. Each physical page includes a section allocated for data (e.g., 512 bytes-16 KB and more) and a small amount of spare bytes (e.g., 64-1024 bytes or more bytes for every page) for storing redundancy and metadata.
The redundancy bytes are used to store error correcting information, for correcting errors which may have occurred during flash memory device lifetime and the page read process. Each programming (write) operation is performed on an entire page. A number of pages are grouped together to form an erase block (also referred to as block). A page cannot be erased unless the entire block (which includes that page) is erased.
Non-limiting examples of flash storage devices may include Secure Digital cards (SD), embedded Multi-Media cards (eMMC). USB drives, and Solid State Disks (SSDs). The flash storage device (such as an SSD, a SD card, a USB drive or an eMMC card) may typically include a flash memory device and a flash memory controller.
The flash storage device may be connected to another computer (referred to as a host computer or simply host) via an interface.
The interface supports a protocol that defines fixed size transfers (for example—512 bytes or an integer multiplication of 512 bytes) of data with a predetermined header indicative of whether the command is a read command or a write command. The protocol does not allow sending memory management metadata attached to the data itself.
FIG. 1 illustrates a prior art read or write command 10. The read or write command 10 includes a 32-bit header 12 and if it is a write command—also includes one or more data chunks 14 of 512 bytes each. In a read command data is sent from the flash memory device to the host computer. The header 12 indicates whether the command is a read command or a write command.
The flash memory controller translates commands received from the interface into actions (Read/Write/Erase) on the flash memory device. The most common commands may be read commands and write commands of one or more sectors, where a sector may be, but is not limited to, a sequence of 512 bytes.
The read commands or write commands may be of a single sector or multiple sectors. These commands may refer to logical addresses. These addresses may then be redirected to new addresses on the flash memory device which need not directly correspond to the logical addresses that might be referenced by the read or write commands.
This is due to memory management that may be carried out by the flash memory controller in order to support several features such as wear-leveling, bad block management, error-correction, and others.
Because of this functionality, before the data of a selected block may be replaced, such as during a write function, the new data must be written in an alternative location before an erase can occur, to preserve the integrity of the stored data.
Such memory management may require resources such as memory. In many flash storage devices, the flash memory controller may typically have only a small random access memory (RAM) available for storage. The small size of the RAM limits the type of memory management which may be carried out by the flash memory controller with regard to the data stored in the flash memory device and data received via the interface.
Performance-oriented flash storage devices may typically manage the flash memory device at the page level. In this approach, each logical page address is associated with an arbitrary physical page address, and the flash memory controller maintains this association (mapping). In this method, part of the physical space is mapped to logical data (user data), and the rest of the physical space is set aside for memory management purposes and is typically named over provisioning.
At each time, one or more blocks may be open for writing. When a logical page is to be written, the flash memory controller writes its content into the next available physical page in an open block and updates the physical association of this logical page to the new location. The previous physical location which held the data of this logical address prior to the write is typically designated as obsolete or superseded. The remaining physical pages in a block which are not superseded are called valid physical pages. Once all of the physical pages of an open block are written, a fresh block from the over provisioning is taken, and future writes resume to this block.
Once no more free blocks from the over provisioning are available to host new pages, or the number of free blocks is reduced below some threshold, the flash memory controller begins a process in which valid physical pages from a first block with superseded physical pages are copied into a second empty block, and once no more valid physical pages are left in the first block, the first block is added to the list of free blocks. This process is typically called cleaning.
A logical page designated by a logical page address is read by first looking up its physical address and then reading the data from the physical address which is associated to this logical page.
The flash memory controller may implement a logical to physical (L2P) mapping between a logical page address and a physical page address by means of a L2P table. The L2P table may be a list of entries that hold, for each logical page which is mapped in the user space, a corresponding physical address.
However, such management may require L2P tables which are much larger than the available resources in a flash storage device such as an SD card or an eMMC card.
Therefore, SD cards, will typically manage the flash memory devices at the block level. Modification to some data in the blocks will require copying an entire block with the relevant data modified. Alternatively, SD card and eMMC cards may implement a hybrid management approach, where some of the memory area is used as a buffer and is managed at a smaller granularity (e.g. page) and the rest of the memory is managed at the block level.
In addition, a flash storage device such as an SD or eMMC card, the flash storage device may store some of the databases used in management (e.g. L2P) on the flash memory devices, to overcome the limited size of RAM. However, this is not very efficient, as every read operation or write operation may first require reading an L2P portion from the flash memory device and updating it in the flash memory device, before accessing the data stored in the flash memory device and prior to completing a write task.
There is a growing need to provide efficient memory management schemes.